home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: MyAmigaAppIcon.dopus5 0.500 (21 Jul 1997)
- Written by Dominique Dutoit (eightyfour@hotmail.com).
-
- ARexx script for Directory Opus 5.5 to create an AppIcon named "My Amiga".
-
- And then your Amiga is smarter! Why? This script is based on a feature
- from the MacOS : when you drop an extension, a control panel, or a font
- on the System Folder, the Mac asks you if you want to put the dropped
- file in the appropriated folder.
-
- This script emulates this feature by using DOpus filetypes, and you
- can customize it at wish (which is not the case with MacOS, and you can
- still wait Windoze 2000 to get something like that).
-
- The magic mode - is a way to disable the confirmation requester. Imagine
- you drop a library and a device on the appicon : the library will be copied
- to LIBS: and the device to DEVS: without asking anything to you. Note that
- the version checking of DOpus is activated, so if the dropped file is
- a different version that the previous one, you will be asked to confirm.
-
- This script is a prototype, and you must be careful. I can't be responsible
- of any damage caused to your Amiga. Use it at your own risks. Read
- "MyAmigaAppIcon.readme" on how to install the package.
-
- Send your bug reports and suggestions to eightyfour@hotmail.com.
-
- Function : ARexx DOpus5:ARexx/MyAmigaAppIcon.dopus5 {Qp} {Qs}
- */
-
- options results
-
- parse arg portname screenname .
- if portname='' then
- portname='DOPUS.1'
- address value portname
- if screenname~='' & screenname~='SCREEN' then
- screenname='PUBSCREEN' screenname
-
- lf='0a'x
-
- if ~show('l','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30)
-
- handlername='MyAmigaAppIcon.'portname
- if show('p',handlername) then do
- dopus request '"My Amiga AppIcon'lf'is already running!" OK'
- exit
- end
- call openport(handlername)
-
- iconmenu.COUNT = 3
- iconmenu.0 = 'libs:'
- iconmenu.1 = 'devs:'
- iconmenu.2 = 'classes:'
- dispreq = TRUE
-
- dopus addappicon handlername '"My Amiga" 1' icon 'DOpus5:Icons/MyAmiga' close local info quotes menu iconmenu
- myicon=result
-
- do until event='close' | event='removed'
- if waitpkt(handlername) then do
-
- packet=getpkt(handlername)
- if packet~='00000000'x then do
-
- event=getarg(packet,0)
- id=getarg(packet,1)
- namestr=getarg(packet,2)
- handle=getarg(packet,3)
-
- select
- when event='dropfrom' then do
- dopus setappicon myicon busy on
- lister set handle busy on
- do while namestr~==''
- parse var namestr '"' thisfile '"' namestr
- if handle>0 then do
- lister query handle path
- nameoffile=thisfile
- thisfile=result||thisfile
- end
- dopus getfiletype '"'thisfile'"' 'id'
-
- filetype = STRIP(RESULT,"B",'"')
- fileis = ''
-
- IF filetype ~='' then do
- select
- when filetype = 'LIBRARY' then do
- fileis = 'a library'
- copyto = 'LIBS:'
- end
- when filetype = 'DEVICE' then do
- fileis = 'a device'
- copyto = 'DEVS:'
- end
- when filetype = 'DT' then do
- fileis = 'a datatype'
- copyto = 'SYS:classes/datatypes/'
- end
- when filetype = 'DTDESC' then do
- fileis = 'a datatype descriptor'
- copyto = 'DEVS:datatypes/'
- end
- when filetype = 'BCLASS' then do
- fileis = 'a BOOPSI class'
- copyto = 'SYS:classes/'
- end
- when filetype = 'BGADGET' then do
- fileis = 'a BOOPSI gadget'
- copyto = 'SYS:classes/gadgets/'
- end
- when filetype = 'BIMAGE' then do
- fileis = 'a BOOPSI image'
- copyto = 'SYS:classes/image/'
- end
- when filetype = 'MUI' then do
- fileis = 'a MUI file'
- copyto = 'MUI:libs/mui/'
- end
- when filetype = 'MCP' then do
- fileis = 'a MCP file'
- copyto = 'MUI:libs/mui/'
- end
- when filetype = 'MCC' then do
- fileis = 'a MCC file'
- copyto = 'MUI:libs/mui/'
- end
- when filetype = 'MLIB' then do
- fileis = 'a MUI library'
- copyto = 'MUI:libs/mui/'
- end
- when filetype = 'MCLASS' then do
- fileis = 'a MUI class'
- copyto = 'MUI:libs/mui/'
- end
- when filetype = 'DOPUS5' then do
- fileis = 'a DOpus 5 script'
- copyto = 'DOPUS5:ARexx/'
- end
- when filetype = 'PPRX' then do
- fileis = 'a PPaint script'
- copyto = 'PPaint:Rexx/'
- end
- when filetype = 'PPLIB' then do
- fileis = 'a PPaint library'
- copyto = 'PPaint:libs/'
- end
- otherwise fileis = ''
- end
- end
-
- if ( fileis ~= '' ) then do
- copynow = FALSE
- if dispreq = TRUE then
- do
- dopus request '"'nameoffile' is 'fileis'.'lf'Do you want to copy it to 'copyto' ?" Yes|No'
- if rc = 1 then copynow = TRUE
- end
- else
- copynow = TRUE
-
- if copynow = TRUE then command wait copy NAME '"'thisfile'"' TO '"'copyto'"'
- end
- end
- lister set handle busy off
- dopus setappicon myicon busy off
- end
- when event='doubleclick' then do
- if dispreq = TRUE then
- do
- dispreq = FALSE
- dopus setappicon myicon text '"My Amiga (Magic)"'
- end
- else
- do
- dispreq = TRUE
- dopus setappicon myicon text '"My Amiga"'
- end
- end
- when event='info' then
- do
- dopus request '"My Amiga AppIcon'lf'Drop files on it to copy them.'lf'Click twice to (des)activate the magic mode." OK|Magic mode ?'
- if RC = 0 then dopus request '"When the magic mode is enabled,'lf'your Amiga doesn''t ask you where'lf'to copy the dropped files." OK'
- end
- when event='menu' then
- do
- select
- when namestr = '0' then command scandir new 'libs:'
- when namestr = '1' then command scandir new 'devs:'
- when namestr = '2' then command scandir new 'sys:classes/'
- otherwise nop
- end
- end
- otherwise
- nop
- end
-
- call reply(packet,0)
- end
- end
- end
-
- dopus remappicon myicon
- call closeport(handlername)
-